All Questions
21 questions
8votes
2answers
482views
Image Rotation and Transpose Functions Implementation in C++
This is a follow-up question for Gaussian Fisheye Image Generator Implementation in C++ and An Updated Multi-dimensional Image Data Structure with Variadic Template Functions in C++. I am trying to ...
6votes
1answer
264views
C++ Eigen/Mex function to perform two pagewise convolutions on a 3D matrix with a simple kernel
I am trying to accelerate an algorithm where I am computing a 2D variance of many complex matrices stored as pages of a 3D array in Matlab. My implementation uses a Mex function with the C++ Matlab ...
3votes
1answer
350views
How can I optimize double for loop in matrix
I am trying to optimize a function called place_block. It is meant to give the best row, col coordinate in the matrix to place a given block of row and column size. ...
5votes
1answer
187views
С++: Find max element from section in matrix
I'm a newbie in programming. Could you please check my code and give any refactoring ideas, tips, etc... how it can be improved. I wrote a code to perform the following task: Find in randomly filled ...
5votes
1answer
450views
2D Matrix in C++20 and Strassen's algorithm
I wrote C++20 implementation of a simple matrix class and its usage in Strassen's \$O(n^{lg_2{7}})\$ matrix multiplication algorithm. Live demo: https://wandbox.org/permlink/JaSC8fQccFbcl1QY (For n = ...
5votes
2answers
495views
A Matrix Library in C++;
I have written a Matrix library that contains all the main properties of matrices. It's a relatively long project, I am hoping it is ok to post here since I really want to have it reviewed. The ...
5votes
2answers
1kviews
Rotate a matrix, using transposition and reflection
I want to compare two solutions to the following question from Cracking The Coding Interview by Gayle Laakman McDowell : 1.7 Rotate Matrix - Given an image represented by an NxN matrix, where each ...
3votes
1answer
264views
Strassen Vinograde Algorithm
I have written an implementation of the Strassen Vinograde Algorithm, but it's running slowly because of recursive creation of static arrays. I know that dynamic arrays would solve this problem, but I'...
5votes
1answer
4kviews
Determinant using Gauss Elimination
We had a question in examination to compute determinant of general square matrix. Now I had made the normal program using Laplace Formula of determinant, ie, recursive solution. Now I was thinking of ...
2votes
1answer
153views
Competition - Qualifications - E - Matrix distance
2 types of query: add value to x y output the sum of \$value*(|a - x|+|b-y|)\$ for every pair(a, b, v). In the start you are given \$n\$ (number of querys), \$m\$ (maximal dimension for square matrix)...
1vote
1answer
552views
Map square coordinates in matrix to flat array indices without hurting performance
I'm more like playing and the problem I'm going to demonstrate is a learning task, so to speak, not something I really need to solve. Imagine having a matrix of data. You chose square in it and ...
1vote
3answers
1kviews
5votes
1answer
1kviews
Minimum number of moves to solve "game of fifteen"
I read about this game and tried to make my own algorithm to solve this. I asked it on StackOverflow for the appropriate algorithm and logic to solve this problem. With the help of answers over ...
7votes
2answers
2kviews
Computing sum on column + sum on row + sum on each diagonal
I have the following problem: I read from a file the dimension(n) of the matrix(which is n * n) and the matrix. For each element ...
4votes
1answer
104views
Make each element equal to its neighbouring element which is maximum in a matrix
I have a matrix and I want to make each of its element equal to the maximum of its neighbouring element and each time I increase number of counts till all the elements in the matrix becomes equal to ...